﻿using System;
using System.IO;

namespace OpenLS.Spreadsheet.Formats.Biff.Records
{
    internal class CFGradientItem
    {
        private double numGrange;
        private CFColor color;

        public CFGradientItem(SpreadsheetColor spreadsheetColor, double value)
        {
            this.color = new CFColor(spreadsheetColor);
            this.numGrange = value;
        }

        public CFGradientItem()
        {
        }

        public void Read(BinaryReader reader)
        {
            this.numGrange = reader.ReadDouble();
            this.color = new CFColor();
            this.color.Read(reader);
        }

        public void Write(BinaryWriter writer)
        {
            writer.Write(this.numGrange);
            color.Write(writer);
        }

        public SpreadsheetColor ToColor()
        {
            return color.ToColor();
        }
    }
}